package feeinterface.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.ulwx.tool.DbUtils;
import feeinterface.modeldb.ChannelProvinceMtCloseTimeLen;

/**
 * 
 * @author 黄杰
 * 
 */
public class ChannelProvinceMtCloseTimeLenDao {

	private static final Logger log = Logger
			.getLogger(ChannelProvinceMtCloseTimeLenDao.class);

	/**
	 * 根据省份获取屏蔽下行时长
	 * 
	 * @param ProvinceID
	 * @return
	 * @throws Exception
	 */
	public static int getMtCloseTimeLenBy(Integer ProvinceID) {

		String sql = "SELECT * FROM ChannelProvinceMtCloseTimeLen WHERE ProvinceID= ?";
		Map<Integer, Object> map = new HashMap<Integer, Object>();
		map.put(1, ProvinceID);
		try {
			List<ChannelProvinceMtCloseTimeLen> list = DbUtils.doQueryClass(
					null, ChannelProvinceMtCloseTimeLen.class, sql, map);
			if (list != null && list.size() >= 1) {
				ChannelProvinceMtCloseTimeLen ctl = list.get(0);
				return ctl.getCloseMtTimeLength();
			}
		} catch (Exception e) {
			log.error("", e);
			return 120;
		}
		return 120;
	}
}
